home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / performPlayblast.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  19.9 KB  |  741 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  Dec 3, 1996
  22. //
  23. //  Description:
  24. //      This script is a template script for option box dialogs.
  25. //
  26. //  Input Arguments:
  27. //      None.
  28. //
  29. //  Return Vaalue:
  30. //      None.
  31. //
  32.  
  33. proc setOptionVars (int $forceFactorySettings)
  34. {
  35.     if( $forceFactorySettings || !`optionVar -exists playblastUseStartEnd`) {
  36.         optionVar -intValue playblastUseStartEnd 0;
  37.     }
  38.     if( $forceFactorySettings || !`optionVar -exists playblastStartTime`) {
  39.         optionVar -floatValue playblastStartTime 1.0;
  40.     }
  41.     if( $forceFactorySettings || !`optionVar -exists playblastEndTime`) {
  42.         optionVar -floatValue playblastEndTime 10.0;
  43.     }
  44.     if( $forceFactorySettings || !`optionVar -exists playblastViewerOn`) {
  45.         optionVar -intValue playblastViewerOn 1;
  46.     }
  47.     if( $forceFactorySettings || !`optionVar -exists playblastOutputFormat`) {
  48.         if(`about -linux`) {
  49.             optionVar -stringValue playblastOutputFormat "iff";
  50.         } else if (`about -mac`){
  51.             optionVar -stringValue playblastOutputFormat "qt";
  52.         } else {
  53.             optionVar -stringValue playblastOutputFormat "sgi";
  54.         }
  55.     }
  56.     if( $forceFactorySettings || !`optionVar -exists playblastCompression` ) {
  57.         optionVar -stringValue playblastCompression "rle";
  58.     }
  59.     if( $forceFactorySettings || !`optionVar -exists playblastScale` ) {
  60.         optionVar -floatValue
  61.          playblastScale .5;
  62.     }
  63.     if( $forceFactorySettings || !`optionVar -exists playblastSaveToFile` ) {
  64.         optionVar -intValue playblastSaveToFile 0;
  65.     }
  66.     if( $forceFactorySettings || !`optionVar -exists playblastFile` ) {
  67.         string $filename = `file -q -sn`;
  68.         if ($filename != "") {
  69.  
  70.             // extract the filename from the path
  71.             //
  72.             string $tokens[];
  73.             tokenize($filename,"/",$tokens);
  74.             $filename = $tokens[size($tokens)-1];
  75.  
  76.             // remove the extension from the filename
  77.             //
  78.             clear $tokens;
  79.             tokenize($filename,".",$tokens);
  80.             $filename = $tokens[0];
  81.  
  82.         } else {
  83.             // no filename, use "playblast" as the default
  84.             // playblast file name
  85.             $filename = "playblast";
  86.         }
  87.         optionVar -stringValue playblastFile $filename;
  88.     }
  89.     if( $forceFactorySettings || !`optionVar -exists playblastShowOrnaments` ) {
  90.         optionVar -intValue playblastShowOrnaments 1;
  91.     }
  92.     if( $forceFactorySettings || !`optionVar -exists playblastDisplaySizeSource` ) {
  93.         optionVar -intValue playblastDisplaySizeSource 1;
  94.     }
  95.     if( $forceFactorySettings || !`optionVar -exists playblastWidth` ) {
  96.         optionVar -intValue playblastWidth 256;
  97.     }
  98.     if( $forceFactorySettings || !`optionVar -exists playblastHeight` ) {
  99.         optionVar -intValue playblastHeight 256;
  100.     }
  101.     if( $forceFactorySettings || !`optionVar -exists playblastClearCache` ) {
  102.         optionVar -intValue playblastClearCache 1;
  103.     }
  104. }
  105.  
  106. global proc playblastSetup (string $parent, int $forceFactorySettings)
  107. {
  108.     // Retrieve the option settings
  109.     //
  110.     setOptionVars( $forceFactorySettings );
  111.     setParent $parent;
  112.     
  113.     // time range 
  114.     //
  115.     int $useStartEnd = `optionVar -query playblastUseStartEnd`;
  116.     radioButtonGrp -edit -select ($useStartEnd + 1) useStartEnd;
  117.  
  118.     float $startTime = `optionVar -query playblastStartTime`;
  119.     floatFieldGrp -enable $useStartEnd -edit -value1 $startTime startTime;
  120.  
  121.     float $endTime = `optionVar -query playblastEndTime`;
  122.     floatFieldGrp -enable $useStartEnd -edit -value1 $endTime endTime;
  123.  
  124.     // viewer 
  125.     //
  126.     int $isViewer = `optionVar -query playblastViewerOn`;
  127.     checkBoxGrp -edit -value1 $isViewer viewerOn;
  128.  
  129.     // Show ornaments
  130.     //
  131.     int $isShowOrnaments = `optionVar -query playblastShowOrnaments`;
  132.     checkBoxGrp -edit -value1 $isShowOrnaments showOrnaments;
  133.  
  134.     // output format
  135.     // 
  136.     string $format = `optionVar -query playblastOutputFormat`;
  137.     if( $format == "iff") {
  138.         radioButtonGrp -edit -select 2 format;
  139.     } else {
  140.         radioButtonGrp -edit -select 1 format;
  141.     }
  142.  
  143.     if(`about -irix`) {
  144.         // compression
  145.         //
  146.         string $compression = `optionVar -query playblastCompression`;
  147.         if( $compression == "mvc1" ) {
  148.             optionMenuGrp -edit -select 1 compression;
  149.         }
  150.         else if( $compression == "mvc2" ) {
  151.             optionMenuGrp -edit -select 2 compression;
  152.         }
  153.         else if( $compression == "jpeg" ) {
  154.             optionMenuGrp -edit -select 3 compression;
  155.         }
  156.         else if( $compression == "rle" ) {
  157.             optionMenuGrp -edit -select 4 compression;
  158.         }
  159.         else if( $compression == "none" ) {
  160.             optionMenuGrp -edit -select 5 compression;
  161.         }
  162.         else {
  163.             optionMenuGrp -edit -select 1 compression;
  164.         }
  165.         optionMenuGrp -edit -enable ($format == "sgi") compression;
  166.     }else if(`about -nt`) {
  167.         button -edit -enable ($format == "sgi") compression;
  168.     }else if(`about -linux`) {
  169.         radioButtonGrp -edit -select 2 format;
  170.     }else if (`about -mac`){
  171.         button -edit -enable ($format == "qt") compression;
  172.     }
  173.  
  174.  
  175.     // scale
  176.     // 
  177.     float $percent = `optionVar -query playblastScale`;
  178.     floatSliderGrp -e -value $percent percent;
  179.  
  180.     // Display size
  181.     //
  182.     int $displayWidth = `optionVar -query playblastWidth`;
  183.     int $displayHeight = `optionVar -query playblastHeight`;
  184.     int $displaySource = `optionVar -query playblastDisplaySizeSource`;
  185.     intFieldGrp -edit
  186.         -value1 $displayWidth
  187.         -value2 $displayHeight
  188.         displaySizeField;
  189.     optionMenuGrp -edit -select $displaySource displaySizeMenu;
  190.     switch ($displaySource) {
  191.     case 1:
  192.     case 2:
  193.         intFieldGrp -edit
  194.             -enable false
  195.             displaySizeField;
  196.         break;
  197.     case 3:
  198.         intFieldGrp -edit
  199.             -enable true
  200.             displaySizeField;
  201.         break;
  202.     }
  203.  
  204.     // Save to file?
  205.     //
  206.     int $saveToFile = `optionVar -query playblastSaveToFile`;
  207.     checkBoxGrp -e -value1 $saveToFile saveToFile;
  208.     playblastSaveToFile( $saveToFile );
  209.  
  210.     // filename (note that optionVars should *not* be set
  211.     // in this proc, setOptionVars() does that)
  212.     // 
  213.     string $filename = `optionVar -query playblastFile`;
  214.     textFieldGrp -e -fileName $filename movieFileName;
  215.  
  216.     // Clear Cache
  217.     //
  218.     int $isClearCache = `optionVar -query playblastClearCache`;
  219.     checkBoxGrp -edit -value1 $isClearCache clearCache;
  220.  
  221. }
  222.  
  223. global proc playblastCallback( string $parent, int $doIt )
  224. //
  225. // Description:
  226. //    Set the optionVar's from the control values, and then perform
  227. //    the command
  228. //
  229. {
  230.     setParent $parent;
  231.     
  232.     // Time Range. 
  233.     //
  234.     int $useStartEnd = `radioButtonGrp -query -select useStartEnd`;
  235.     optionVar -intValue playblastUseStartEnd ($useStartEnd - 1);
  236.  
  237.     float $startTime = `floatFieldGrp -query -value1 startTime`;
  238.     optionVar -floatValue playblastStartTime $startTime;
  239.  
  240.     float $endTime = `floatFieldGrp -query -value1 endTime`;
  241.     optionVar -floatValue playblastEndTime $endTime;
  242.  
  243.     // Viewer
  244.     //
  245.     int $isViewer = `checkBoxGrp -query -value1 viewerOn`;
  246.     optionVar -intValue playblastViewerOn $isViewer;
  247.  
  248.     // Show ornaments
  249.     //
  250.     int $isShowOrnaments = `checkBoxGrp -query -value1 showOrnaments`;
  251.     optionVar -intValue playblastShowOrnaments $isShowOrnaments;
  252.  
  253.     // Output format
  254.     //
  255.     int $selected = `radioButtonGrp -query -select format`;
  256.     string $format;
  257.     
  258.     if( $selected == 2 )
  259.     {
  260.         $format = "iff";
  261.     } else {
  262.         if(`about -mac`){
  263.             $format = "qt";
  264.         }else{
  265.             $format = "sgi";
  266.         }
  267.     }
  268.     optionVar -stringValue playblastOutputFormat $format;
  269.     
  270.     // compression
  271.     //
  272.     string $compression;
  273.     if(`about -irix`) {
  274.         $selected = `optionMenuGrp -query -select compression`;
  275.  
  276.         if( $selected == 1 ) {
  277.             $compression = "mvc1";
  278.         } else if( $selected == 2 ) {
  279.             $compression = "mvc2";
  280.         } else if( $selected == 3 ) {
  281.             $compression = "jpeg";
  282.         } else if( $selected == 4 ) {
  283.             $compression = "rle";
  284.         } else {
  285.             $compression = "none";
  286.         }
  287.     } else {
  288.         $compression = "none";
  289.     }
  290.     optionVar -stringValue playblastCompression $compression;
  291.  
  292.     // scale
  293.     // 
  294.     float $scale = `floatSliderGrp -q -value percent`;
  295.     optionVar -floatValue playblastScale $scale;
  296.  
  297.     // Display size
  298.     //
  299.     int $displaySource = `optionMenuGrp -query -select displaySizeMenu`;
  300.     optionVar -intValue playblastDisplaySizeSource $displaySource;
  301.     if ($displaySource == 3) {
  302.         int $displayWidth = `intFieldGrp -query -value1 displaySizeField`;
  303.         int $displayHeight = `intFieldGrp -query -value2 displaySizeField`;
  304.         optionVar -intValue playblastWidth $displayWidth;
  305.         optionVar -intValue playblastHeight $displayHeight;
  306.     }
  307.  
  308.     // Save to file
  309.     //
  310.     int $saveToFile = `checkBoxGrp -q -value1 saveToFile`;
  311.     optionVar -intValue playblastSaveToFile $saveToFile;
  312.  
  313.     // filename
  314.     // 
  315.     string $filename = `textFieldGrp -q -fileName movieFileName`;
  316.     optionVar -stringValue playblastFile $filename;
  317.  
  318.     // Depends on where the callback comes from
  319.     // From the Time Slider, $doIt is 2.
  320.     //
  321.     if( $doIt == 1 ) {
  322.         performPlayblast 0;
  323.         addToRecentCommandQueue "performPlayblast 0" "PlayBlast";
  324.     } else if( $doIt == 2 ) {
  325.         performPlayblast 3;
  326.         addToRecentCommandQueue "performPlayblast 3" "PlayBlast";
  327.     }
  328.  
  329.     // Clear cache
  330.     //
  331.     int $isClearCache = `checkBoxGrp -query -value1 clearCache`;
  332.     optionVar -intValue playblastClearCache $isClearCache;
  333. }
  334.  
  335. global proc int playblastUpdateMovieName( string $filename, string $fileType )
  336. {
  337.     textFieldGrp -e -fileName $filename movieFileName;
  338.     optionVar -stringValue playblastFile $filename;
  339.     return 1;
  340. }
  341.  
  342. global proc playblastMovieplayerFormat()
  343. {
  344.     control -edit -enable true compression;
  345.     textFieldGrp -e -l "Movie file" movieFileName;
  346. }
  347.  
  348. global proc playblastQTFormat()
  349. {
  350.     control -edit -enable true compression;
  351.     textFieldGrp -e -l "Movie file" movieFileName;
  352. }
  353.  
  354. global proc playblastFcheckFormat()
  355. {
  356.     control -edit -enable false compression;
  357.     textFieldGrp -e -l "Image file prefix" movieFileName;
  358. }
  359.  
  360. global proc playblastSaveToFile( int $i )
  361. {
  362.     if( $i ) {
  363.         checkBoxGrp -e -value1 on saveToFile;
  364.         textFieldGrp -e -enable true movieFileName;
  365.         button -e -enable true browser;
  366.     } else {
  367.         checkBoxGrp -e -value1 on viewerOn;
  368.         checkBoxGrp -e -value1 off saveToFile;
  369.         textFieldGrp -e -enable false movieFileName;
  370.         button -e -enable false browser;
  371.     }
  372. }
  373.  
  374. global proc playblastDisplaySizeMenuCB (string $tabLayout)
  375. {
  376.     setParent $tabLayout;
  377.  
  378.     int $option = `optionMenuGrp -query -select displaySizeMenu`;
  379.     switch ($option) {
  380.     case 1:    // From window
  381.     case 2:    // From render globals
  382.         intFieldGrp -edit -enable false displaySizeField;
  383.         break;
  384.     case 3:    // Custom
  385.         intFieldGrp -edit -enable true displaySizeField;
  386.         break;
  387.     }
  388. }
  389.  
  390. global proc playblastFileBrowser()
  391. {
  392.     // only set the working directory if the
  393.     // playblastFile optionVar is not an absolute
  394.     // path
  395.     //
  396.     string $pathname;
  397.     int    $isAbsolute = false;
  398.     if ( `optionVar -exists playblastFile` ) {
  399.         string $filename = `optionVar -q playblastFile`;
  400.         if ( $filename != "" &&
  401.             (substring($filename,1,1) == "/"
  402.             ||substring($filename,1,1) == "$") )
  403.         {
  404.             $isAbsolute = true;
  405.         }
  406.     }
  407.  
  408.     if ( !$isAbsolute ) {
  409.  
  410.         // get the workspace
  411.         //
  412.         string    $workspace = `workspace -q -fn`;
  413.  
  414.         // get the project's image directory
  415.         //
  416.         string $fileRules[] = `workspace -q -fr`;
  417.         int $i;
  418.         string $imageDir = ""; // default is current dir
  419.         for ( $i = 0; $i < size($fileRules); $i += 2 ) {
  420.             if ( $fileRules[$i] == "image" ) {
  421.                 $imageDir = $fileRules[$i+1];
  422.                 break;
  423.             }
  424.         }
  425.  
  426.         if ( $imageDir != "" ) {
  427.             // set the current working directory
  428.             //
  429.             setWorkingDirectory $workspace "image" $imageDir;
  430.         }
  431.     }
  432.  
  433.     // win32 should be "save to" since "open" requires an existing file
  434.     fileBrowser("playblastUpdateMovieName","Accept","",1);
  435. }
  436.  
  437.  
  438. proc string playblastBasic( string $tabLayout, int $hideTimeRange )
  439. {
  440.     setParent $tabLayout;
  441.     
  442.     string $tabForm = `columnLayout -adjustableColumn true`;
  443.  
  444.     // Time Range
  445.     //
  446.     frameLayout -bv no -lv no -collapsable yes -collapse $hideTimeRange
  447.         startEndFrame;
  448.         columnLayout -adjustableColumn true;
  449.             radioButtonGrp -l "Time Range" -nrb 2 
  450.                 -changeCommand ( "floatFieldGrp -e -enable (`radioButtonGrp -q -sl useStartEnd` == 2) startTime; floatFieldGrp -e -enable (`radioButtonGrp -q -sl useStartEnd` == 2) endTime; ")
  451.                 -select 1
  452.                 -label1 "Time Slider" 
  453.                 -l2 "Start/End" 
  454.                 useStartEnd;
  455.  
  456.             floatFieldGrp -enable 0 -label "Start Time" -value1 0.0 startTime;
  457.             floatFieldGrp -enable 0 -label "End Time" -value1 10.0 endTime;
  458.  
  459.             separator -style "in" -w 1000;
  460.  
  461.             setParent ..;
  462.         setParent ..;
  463.  
  464.     // Make viewer on/off button.
  465.     //
  466.     checkBoxGrp -l "View" -ncb 1 -value1 on -l1 "" 
  467.         -offCommand "playblastSaveToFile true" viewerOn;
  468.  
  469.     // Show ornaments
  470.     //
  471.     int $isShowOrnaments = `optionVar -query playblastShowOrnaments`;
  472.     checkBoxGrp -label "Show Ornaments"
  473.         -numberOfCheckBoxes 1
  474.         -label1 ""
  475.         showOrnaments;
  476.  
  477.     separator -style "in" -w 1000;
  478.  
  479.     // Output format
  480.     //
  481.     if(`about -linux`) {
  482.         radioButtonGrp -l "Viewer" 
  483.             -nrb 2
  484.             -label1 "xanim "
  485.             -cc1 "playblastMovieplayerFormat"
  486.             -en1 false
  487.             -label2 "fcheck"
  488.             -cc2 "playblastFcheckFormat"
  489.             -select 2
  490.             format;
  491.     }else if(`about -mac`) {
  492.         radioButtonGrp -l "Viewer" 
  493.             -nrb 2
  494.             -label1 "QuickTime "
  495.             -cc1 "playblastQTFormat"
  496.             -label2 "fcheck"
  497.             -cc2 "playblastFcheckFormat"
  498.             -select 2
  499.             format;
  500.     }else{
  501.         radioButtonGrp -l "Viewer" 
  502.             -nrb 2
  503.             -label1 "Movieplayer "
  504.             -cc1 "playblastMovieplayerFormat"
  505.             -label2 "fcheck"
  506.             -cc2 "playblastFcheckFormat"
  507.             -select 1
  508.             format;
  509.     }
  510.     
  511.     // Compression
  512.     //
  513.     if (`about -nt`) {
  514.         rowLayout -nc 2 -cw 1 170 -cw 2 240 -cal 2 "center";
  515.             text -l "";
  516.             button -l "Compression..." -enable true -c "playblast -options" compression;
  517.         setParent ..;
  518.     }else if (`about -linux`) {
  519.         optionMenuGrp -l "Compression" -enable false compression;
  520.             setParent -m ..;
  521.     }else if(`about -irix`) {
  522.         optionMenuGrp -l "Compression" -enable true compression;
  523.             menuItem -l "MVC1";
  524.             menuItem -l "MVC2";
  525.             menuItem -l "JPEG";
  526.             menuItem -l "RLE";
  527.             menuItem -l "None";
  528.             setParent -m ..;
  529.     }else if (`about -mac`) {
  530.         rowLayout -nc 2 -cw 1 170 -cw 2 240 -cal 2 "center";
  531.             text -l "";
  532.             button -l "Compression..." -enable true -c "playblast -options" compression;
  533.         setParent ..;
  534.     }else{
  535.         optionMenuGrp -l "Compression" -enable true compression;
  536.             setParent -m ..;
  537.     }
  538.  
  539.     separator -style "in" -w 1000;
  540.  
  541.     // Display size
  542.     //
  543.     optionMenuGrp -label "Display Size"
  544.         -changeCommand ("playblastDisplaySizeMenuCB " + $tabLayout)
  545.         displaySizeMenu;
  546.         menuItem -label "From Window";
  547.         menuItem -label "From Render Globals";
  548.         menuItem -label "Custom";
  549.         setParent -menu ..;
  550.     intFieldGrp -label ""
  551.         -numberOfFields 2
  552.         displaySizeField;
  553.  
  554.     // Scale
  555.     //
  556.     floatSliderGrp -field yes -min .1 -max 1.0 -pre 2 -label "Scale" percent;
  557.  
  558.     separator -style "in" -w 1000;
  559.  
  560.     // Clear cache
  561.     //
  562.     int $isClearCache = `optionVar -query playblastClearCache`;
  563.     checkBoxGrp -label "Remove Temporary Files"
  564.         -numberOfCheckBoxes 1
  565.         -label1 ""
  566.         clearCache;
  567.  
  568.     // Save to file
  569.     //
  570.     checkBoxGrp -l "Save to File" -ncb 1 -value1 off -l1 "" -cc1 "playblastSaveToFile #1" 
  571.         saveToFile;
  572.  
  573.     // Filename
  574.     //
  575.     if(`about -linux`){
  576.         textFieldGrp -l "Image file prefix" -enable false movieFileName;
  577.     }else{
  578.         textFieldGrp -l "Movie file" -enable false movieFileName;
  579.     }
  580.  
  581.     // Browser
  582.     //
  583.     rowLayout -nc 2 -cw 1 170 -cw 2 240 -cal 2 "center";
  584.         text -l "";
  585.         button -l "Browse..." -align "center" -enable false -c 
  586.             "playblastFileBrowser" browser;
  587.     setParent ..;
  588.  
  589.     return $tabForm;
  590. }
  591.  
  592. global proc playblastOptions( int $hideTimeRange )
  593. {
  594.     // Name of the command for this option box 
  595.     //
  596.     string $commandName = "playblast";
  597.  
  598.     // Title for the option box window
  599.     //
  600.     string $optionBoxTitle = "Playblast Options";
  601.  
  602.     // Title for the apply button
  603.     // 
  604.     string $applyTitle = "Playblast";
  605.     
  606.     // Build the option box "methods"
  607.     //
  608.     string $callback = ($commandName + "Callback");
  609.     string $setup = ($commandName + "Setup");
  610.     
  611.     // Build the window, with a tab layout
  612.     //
  613.     string $widgetList[] = `getStandardWindow $optionBoxTitle 0 "noOptions"`;
  614.     setUITemplate -pushTemplate DefaultTemplate;
  615.  
  616.     // Make the form invisible while we create the widgets in the window
  617.     //
  618.     formLayout -e -vis false $widgetList[1];
  619.  
  620.     // Put the widgets in the layout
  621.     //
  622.     playblastBasic $widgetList[2] $hideTimeRange;
  623.  
  624.     // Attach the standard buttons
  625.     //
  626.     string $buttonList[] = `addStandardButtons $commandName $applyTitle $widgetList[1] $widgetList[2] "noOptions"`;
  627.     
  628.     // attach commands to the standard buttons
  629.     //
  630.     // Save
  631.     //
  632.     button -e -c ($callback + " " + $widgetList[0] + " false" +
  633.                   "; hideOptionBox()") $buttonList[3];
  634.     
  635.     // Close
  636.     //
  637.     button -edit -command hideOptionBox $buttonList[2];
  638.  
  639.     // Reset
  640.     //
  641.     button -edit -command ($setup + " " + $widgetList[0] + " true") 
  642.         $buttonList[1];
  643.  
  644.     // Do It
  645.     // Note: JUST for the Playblast option box, when you do the Playblast,
  646.     // it will delete the option box window. This is because the Playblast
  647.     // operation pushes the Maya window to the front to do the screen grabs,
  648.     // and the option box would remain open but unseen by the user.
  649.     //
  650.     button -edit -command ("window -edit -i true " + $widgetList[0] + "; " +
  651.                     $callback + " " + $widgetList[0] + " " + 
  652.                            ( 1 + $hideTimeRange ) + " " +
  653.                     "; hideOptionBox()") 
  654.         $buttonList[0];
  655.  
  656.     // Make the form layout visible so we can see what we built, and
  657.     // reset the template
  658.     //
  659.     formLayout -e -vis true $widgetList[1];
  660.     setUITemplate -popTemplate;
  661.  
  662.     //    Customize the 'Help' menu item text.
  663.     //
  664.     setOptionBoxHelpTag( "Playblast" );
  665.  
  666.     // Call the setup "method" to fill in the current settings
  667.     //
  668.     eval (($setup + " " + $widgetList[0] + " false"));
  669.     showOptionBox();
  670.     showWindow $widgetList[0];
  671. }
  672.  
  673. proc string assembleCmd( int $useTimeSliderHighlight )
  674. //
  675. // Description:
  676. //    
  677. //    
  678. {
  679.     int $useStartEnd;
  680.  
  681.     // This makes sure that when we're called from the time slider, we
  682.     // _never_ look at the start/end values in the option box, since they're
  683.     // not displayed in that version of the option box anyway.
  684.     // 
  685.     if( $useTimeSliderHighlight ) {
  686.         $useStartEnd = 0;
  687.     } else {
  688.         $useStartEnd = `optionVar -query playblastUseStartEnd`;
  689.     }
  690.  
  691.     string $cmd = "doPlayblastArgList 3 { " +
  692.         "\"" + `optionVar -query playblastSaveToFile` + " \"" +
  693.         ",\"" + `optionVar -query playblastFile` + "\"" +
  694.         ",\"" + `optionVar -query playblastViewerOn` + "\"" +
  695.         ",\"" + `optionVar -query playblastOutputFormat` + "\"" +
  696.         ",\"" + `optionVar -query playblastShowOrnaments` + "\"" +
  697.         ",\"" + `optionVar -query playblastScale` + "\"" +
  698.         ",\"" + `optionVar -query playblastCompression` + "\"" +
  699.         ",\"" + `optionVar -query playblastDisplaySizeSource` + "\"" +
  700.         ",\"" + `optionVar -query playblastWidth` + "\"" +
  701.         ",\"" + `optionVar -query playblastHeight` + "\"" +
  702.         ",\"" + $useStartEnd + "\"" +
  703.         ",\"" + `optionVar -query playblastStartTime` + "\"" +
  704.         ",\"" + `optionVar -query playblastEndTime` + "\"" +
  705.         ",\"" + `optionVar -query playblastClearCache` + "\"" +
  706.         "};";
  707.  
  708.     return $cmd;
  709. }
  710.  
  711.  
  712. global proc string performPlayblast( int $action )
  713. {
  714.     string $cmd = "";
  715.  
  716.     switch( $action ) {
  717.         case 0:
  718.             setOptionVars( false );
  719.             $cmd = `assembleCmd 0`;
  720.             eval( $cmd );
  721.             break;
  722.         case 1:
  723.             playblastOptions 0;
  724.             break;
  725.         case 2:
  726.             setOptionVars( false );
  727.             $cmd = `assembleCmd 0`;
  728.             break;
  729.         case 3:
  730.             setOptionVars( false );
  731.             $cmd = `assembleCmd 1`;
  732.             eval( $cmd );
  733.             break;
  734.         case 4:
  735.             playblastOptions 1;
  736.             break;
  737.     }
  738.  
  739.     return $cmd;
  740. }
  741.